package com.matrix.java.chap_03;

import java.util.Scanner;

/*
    几何：线段上的点
 */
public class Ex3_34 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter three points for p0, p1, and p2: ");
        double x0 = input.nextDouble();
        double y0 = input.nextDouble();
        double x1 = input.nextDouble();
        double y1 = input.nextDouble();
        double x2 = input.nextDouble();
        double y2 = input.nextDouble();
        double result = (x1-x0)*(y2-y0)-(x2-x0)*(y1-y0);
        if (result ==0&&Math.max(x0,x1)>=x2&&Math.min(x0,x1)<=x2){
            System.out.println("on the line segment");
        }else {
            System.out.println("not on the line segment");
        }
        input.close();
    }
}
